package store.lunangangster.bpmn.model;

/**
 * SequenceFlow用于描述定义在{@link Process}中的{@link FlowElement}的先后顺序以及指向
 *
 * <p>每个SequenceFlow有且仅有一个sourceRef和targetRef属性，用于描述指向信息。
 *
 * <p>sourceRef和targetRef指向的是{@link FlowNode}类型的元素，包括：
 * <ul>
 *   <li>{@link Event}</li>
 *   <li>{@link Activity}</li>
 *   <li>{@link Gateway}</li>
 * </ul>
 *
 * @author cwk
 * @version 1.0
 */
public class SequenceFlow extends FlowElement {

  protected String sourceRef;
  protected String targetRef;
  protected String conditionExpression;

  // 实际指向的元素
  protected FlowNode source;
  protected FlowNode target;

  public String getSourceRef() {
    return sourceRef;
  }

  public void setSourceRef(String sourceRef) {
    this.sourceRef = sourceRef;
  }

  public String getTargetRef() {
    return targetRef;
  }

  public void setTargetRef(String targetRef) {
    this.targetRef = targetRef;
  }

  public String getConditionExpression() {
    return conditionExpression;
  }

  public void setConditionExpression(String conditionExpression) {
    this.conditionExpression = conditionExpression;
  }

  public FlowNode getSource() {
    return source;
  }

  public void setSource(FlowNode source) {
    this.source = source;
  }

  public FlowNode getTarget() {
    return target;
  }

  public void setTarget(FlowNode target) {
    this.target = target;
  }

  @Override
  public String toString() {
    return sourceRef + " ==> " + targetRef;
  }

  @Override
  public String getModelType() {
    return "SEQUENCE_FLOW";
  }
}
